<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>查找最大最小值</title>
    <style>
            a:link,a:visited{
                color: #222;text-decoration: none;}
           a:hover{color: #fd4913;}
       </style>
   
</head>
<body>
    <h2>查找最大值和最小值</h2>
        <script>
                var arr=[100,7,65,54,12,6];
                var min=max=arr[0];
                for(var i=1;i<arr.length;i++){
                    if(arr[i]>max){
                        max=arr[i];
                    }
                    if(arr[i]<min){
                        min=arr[i];
                    }
                }
                console.log('待查找数组：'+arr);
                console.log('最大值：'+max);
                console.log('最小值：'+min);
            </script>
    <p><a href="default.html">返回目录</a></p>
    <p><a href="第三章.html">返回第三章</a></p>
    <p><a href="二维数组转置.html">下一题</a></p>
    <p><a href="第四章.html">下一章</a></p>
</body>
</html>